package com.hhf.rpa.job.config;

import com.hhf.rpa.job.service.BaseJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class StartupListener implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    private BaseJobService baseJobService;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
        // 启动时所有任务状态置为未执行
        baseJobService.updateJobExecStatus(null,null,0);
        log.info("任务状态初始化完成");
    }
}
